<%= form_for @rule do |f| %>
  <div class="row mt mb">
    <div class="large-6 columns">
      <%
        fields = []
        [:from, :subject, :content, :orig_to, :orig_cc, :to].each do |key|
          fields << [t(key, scope: 'activerecord.attributes.ticket'), key]
        end
      %>
      <%= f.select(:filter_field, fields) %>

      <%= f.collection_select(:filter_operation, t('activerecord.attributes.rule.filter_operations'), :first, :last) %>

      <%= f.text_field :filter_value %>

      <%= react_component('RuleFields', {
          actions: {
            assign_label: {
              label: t('activerecord.attributes.rule.action_operations.assign_label'),
              values: @label_options
            },
            assign_user: {
              label: t('activerecord.attributes.rule.action_operations.assign_user'),
              values: @users
            },
            change_status: {
              label: t('activerecord.attributes.rule.action_operations.change_status'),
              values: @statuses
            },
            change_priority: {
              label: t('activerecord.attributes.rule.action_operations.change_priority'),
              values: @priorities
            },
            notify_user: {
              label: t('activerecord.attributes.rule.action_operations.notify_user'),
              values: @users
            }
          },
          label_action_operation: t('activerecord.attributes.rule.action_operation'),
          action_operation: f.object.action_operation,
          action_value: f.object.action_value
      }) %>
    </div>
  </div>

  <div class="row">
    <div class="medium-12 columns bt">
      <%= f.submit t(:save), class: 'success button radius mtl' %>
    </div>
  </div>
<% end %>
